/*
 * @Author: ayun chengyunwu@jiatui.com
 * @Date: 2023-05-08 11:30:02
 * @LastEditors: ayun chengyunwu@jiatui.com
 * @LastEditTime: 2023-07-17 17:31:07
 * @FilePath: /ift-economy-h5/src/router/index.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import React, { lazy } from "react";
import { Navigate } from "react-router-dom";

import { SpinLoading } from "antd-mobile";
import AuthRouter from "@/components/AuthRouter";

// 投资意向登记
// const InvestmentIntention = lazy(
//   () => import('@/pages/Investment-intention/Index')
// )

//入库情况
const StorageSituation = lazy(() => import("@/pages/storage-situation/index"));
//新增挖掘项目
const AddProject = lazy(
  () => import("@/pages/storage-situation/AddProject/index")
);

// 项目详情
const ProjectDetail = lazy(() => import("@/pages/ProjectDetail/index"));
// 项目基本信息编辑
const ProjectBaseinfo = lazy(() => import("@/pages/ProjectBaseinfo/index"));
const EnterpriseInvestment = lazy(() => import("@/pages/EnterpriseInvestment/index"));
const DockingRecords = lazy(() => import("@/pages/DockingRecords/index"));
const NegotiationRecords = lazy(() => import("@/pages/NegotiationRecords/index"));

// 总体情况
const GeneralSituation = lazy(() => import("@/pages/GeneralSituation"));

//项目调度
const ProjectScheduling = lazy(
  () => import("@/pages/project-scheduling/index")
);
//申请项目调度
const ApplyScheduling = lazy(
  () => import("@/pages/project-scheduling/ApplyScheduling/index")
);

const Login = lazy(() => import("@/pages/InvestmentScheduling/Login"));

const InvestmentSchedulingHome = lazy(
  () => import("@/pages/InvestmentScheduling/Home")
);

const NoPage = lazy(() => import("@/pages/404/404"));

const SituationTracking = lazy(
  () => import("@/pages/project-scheduling/SituationTracking")
);

const ProjectProgress = lazy(() => import("@/pages/ProjectProgress"));

export const withLoadingComponent = (comp: JSX.Element) => (
  <React.Suspense
    fallback={
      <div
        className={`d_center_center`}
        style={{
          height: "100vh",
        }}
      >
        <div>
          <SpinLoading style={{ "--size": "48px" }} />
          加载中...
        </div>
      </div>
    }
  >
    {comp}
  </React.Suspense>
);

const routes: any[] = [
  // {
  //   path: '/investment-intention',
  //   element: <InvestmentIntention />,
  // },
  // 投资调度-登录页
  {
    path: "/login",
    // element: <Login />,
    element: <InvestmentSchedulingHome />,
  },
  // 投资调度-首页
  {
    path: "/investment-scheduling-home",
    // element: <AuthRouter component={<InvestmentSchedulingHome />} />,
    element: <InvestmentSchedulingHome />,
    title: "招商引资",
  },
  // 重点项目进展
  {
    path: "/project-progress",
    element: <ProjectProgress />,
    title: "重点项目进展",
  },
  {
    path: "/general-situation",
    element: <GeneralSituation />,
    title: "总体情况",
  },
  {
    path: "/",
    // element: <Navigate replace to="/login" />,
    element: <Navigate replace to="/investment-scheduling-home" />,
  },
  // 访问其余路径的时候直接跳到首页
  {
    path: "/storage-situation",
    element: <StorageSituation />,
    title: "重点项目进展",
  },
  {
    path: "/add-project",
    element: <AddProject />,
    title: "新增挖掘项目",
  },
  {
    path: "/project-detail",
    element: <ProjectDetail />,
    title: "项目详情",
  },
  {
    path: "/project-baseinfo",
    element: <ProjectBaseinfo />,
    title: "项目基本信息",
  },
  {
    path: "/enterprise-investment",
    element: <EnterpriseInvestment />,
    title: "企业投资意向登记表",
  },
  {
    path: "/docking-records",
    element: <DockingRecords />,
    title: "初步对接记录",
  },
  {
    path: "/negotiation-records",
    element: <NegotiationRecords />,
    title: "深入洽谈记录",
  },
  {
    path: "/project-scheduling",
    element: <ProjectScheduling />,
    title: "项目调度",
  },
  {
    path: "/situation-tracking",
    element: <SituationTracking />,
    title: "调度情况跟踪",
  },
  {
    path: "/apply-scheduling",
    element: <ApplyScheduling />,
    title: "部门申请调度",
  },
  {
    path: "*",
    element: <Navigate replace to="/404" />,
  },
  {
    path: "/404",
    element: <NoPage />,
  },
];

export default routes;
